﻿using System;
using System.Data;
using System.Web.UI.WebControls;
using BLL;
using Utils;

namespace UI.ModTrain
{
    public partial class TeacherList : System.Web.UI.Page
    {
        TeacherBiz teacherBiz = new TeacherBiz();

        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["user"] != null)
            {
                User user = Session["user"] as User;
                //account = user.Account;
            }
            else
            {
                JSUtility.Alert(this, "您没有登录!请先登录。");
                return;
            }
            if (!IsPostBack)
            {

                btnAdd.Attributes.Add("onclick", "javascript:ShowLink('TeacherAdd.aspx',800,550);");
               
                    BondData("","Y");
               
            }
            

        }
        private void BondData(string serWord,string statu)
        {
            DataTable dt = teacherBiz.GetLists(serWord, statu);

            if (dt.Rows.Count > 0)
            {
                lbAmount.Text = "合计:    " + dt.Rows.Count;
            }
            else
            {
                lbAmount.Text = "";
            }
            gvList.DataSource = dt;
            gvList.DataBind();

        }
      
        protected void btnEmSearch_Click(object sender, EventArgs e)
        {
            string serWord = txtSerWord.Text.Trim();
            

            if (serWord == "" )
            {
                JSUtility.Alert(this, "至少输入一个查询条件");
                return;
            }
           
            BondData(serWord,"Y");
        }
    }
}